<%@page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="/teleweb/common/global.jsp" %>

<%@page import="com.cndatacom.teleweb.fileupload.been.FileUpload"%>
<%
	String sAttachNum = request.getParameter("attachNum");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>中国通信服务</title>
<link href="teleweb/css/ztf.css" rel="stylesheet" type="text/css" />
<link href="teleweb/css/roll.css" rel="stylesheet" type="text/css" />
<link href="teleweb/css/content.css" rel="stylesheet" type="text/css" />
<link href="teleweb/css/upload-component.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="teleweb/js/upload.js"></script>
<script type="text/javascript" src="teleweb/js/submitFunctions.js"></script>
<script language="javascript" type="text/javascript" src="js/My97DatePicker/WdatePicker.js"></script>

<script>
function initData() {
	var attachNum = "${attachNum}";
	if(attachNum==null || attachNum=="") {
		document.getElementById("attachnum").value = "<%=sAttachNum%>";
	}
	
	var docTime = "${filePublish.uploadDate}";
	var nowTime = getNowTime();
	if(docTime==null || docTime=="") {
		document.getElementById("pubdate").value = nowTime;
	}
}
function window.onbeforeunload(){
	if("${addOrEdit}" == "edit") {
		if(document.getElementById("uploads").innerHTML == null || document.getElementById("uploads").innerHTML == "<UL></UL>") {
			return "修改时不能将附件置空。";
		}
	}
}
//Form重置
function formReset() {
	pubForm.reset();
}
function validData() {
	var title = document.getElementById("filename").value;
	var date = document.getElementById("pubdate").value;
	if(title == "") {
		alert("文档名称不能为空！")
		return false;
	}else if(date == "") {
		alert("请选择上传日期！");
		return false;
	}
	document.getElementById("random").value = document.getElementById("randomfolder").value;
	if(document.getElementById("uploads").innerHTML == null || document.getElementById("uploads").innerHTML == "" || document.getElementById("uploads").innerHTML == "<UL></UL>") {
		alert("附件不能为空。");
		return false;
	}
	pubForm.submit();
}
</script>

</head>
<body onload="initData();initAttach('${filePublish.filePath}','${filePublish.realName}')">

<table width="960" border="0" align="center" cellpadding="0" cellspacing="0">
  <!-- 主体table -->
  <%request.setAttribute("panel","FP");%>
  <%@ include file="/teleweb/common/include/header.jsp" %>
  <tr>
    <!---首页内容--->
    <td class="new_indexcontent">
    <div class="new_stars">
    <div class="new_weizhi">你现在所在的位置：<a href="index">首页</a>><a href="#">文件资料</a></div>
    </div>
    <!---圆角--->
    <div class="box-cir3">
			<div class="t_l"></div>
			<div class="t_m"></div>
			<div class="t_r"></div>
			<div class="m_l"></div>
			<div class="m_m1">
    <!---标题内容--->
			<div class="new_heading1">
            <h3>文件资料</h3>
            </div>
            <div class="new_textform">
            	<form name="pubForm" action="filepub-edit.action" method="post">
            		<table cellpadding="0" cellspacing="0">
            			<input type="hidden" name="filePublish.id" value="${filePublish.id}">
            			<input type="hidden" name="random" id="random">
            			<input type="hidden" id="attachnum" name="attachnum" value="${attachNum}">
            			<input type="hidden" name="allowType" id="allowtype" value="">
            			<tr>
            				<td class="new_textlable"><span class="new_lable">文档名称</span><span class="new_redstar">*</span></td>
            				<td><input type="text" name="filePublish.displayName" value="${filePublish.displayName}" id="filename" class="new_text"></td>
            			</tr>
            			<tr>
            				<td class="new_textlable"><span class="new_lable">上传日期</span><span class="new_redstar">*</span></td>
            				<td>
            					<input class="Wdate" type="text" name="filePublish.uploadDate" value="${fn:substring(filePublish.uploadDate, 0, 19)}" id="pubdate" style="padding-left:4px;width:150" onClick="WdatePicker({skin:'YcloudRed',dateFmt:'yyyy-MM-dd HH:mm:ss'})">
            				</td>
            			</tr>
            		</table>
            	</form>
            	
            	<div style="color:red"><s:fielderror><s:param>attach</s:param></s:fielderror></div>
            	<upload:load></upload:load>
            	
            	<table cellpadding="0" cellspacing="0">
            		<tr>
            			<td class="new_textlable"></td>
            			<td align="center">
    						<div class="new_btform">
    							<button id="saveBnt" class="new_btforml" onclick="validData()">保存</button>
    							<button id="resetBnt" onclick="formReset();">重置</button>
    						</div>
            			</td>
            		</tr>
            	</table>  
			
            </div>                              
			</div>
			<div class="m_r"></div>
			<div class="b_l"></div>
			<div class="b_m"></div>
			<div class="b_r"></div>
		</div>
    </td>
  </tr>
  <%@ include file="../common/include/tail.jsp"%>
</table>
</body>
</html>
